﻿<%@ Page Title="" Language="C#" MasterPageFile="~/template/Admin.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EmptyWallGallery.FrontEnd.inside.Manage.Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="head">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctphTitle" runat="server">
    <h1>Quản lý người dùng</h1>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ctphMain" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="full">
                <div id="dyntable_length" runat="server" class="dataTables_length"></div>

                <asp:GridView ID="grvUsers" CssClass="ze-section-grid" runat="server" AllowPaging="true" AutoGenerateColumns="false" OnPageIndexChanging="GrvUsersChangePage"
                    Width="100%" PageSize="10" OnRowDataBound="GrvUsersRowDataBound" OnRowCommand="GrvUsersCommand" OnRowDeleting="GrvUsersDelete">
                    <Columns>
                        <asp:TemplateField HeaderText="STT" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                            <ItemTemplate>
                                <%# Container.DataItemIndex + 1 %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Tên đăng nhập" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <%# Eval("UserName") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Email" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <%# Eval("Email") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Trạng thái" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <%# ReturnStatus(Eval("IsApproved"), Eval("IsLockedOut"))%>
                                <asp:HiddenField ID="txtApproved" runat="server" Value='<%# Eval("IsApproved").ToString() %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Quyền hạn" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <%# ReturnAllRole(Eval("Username"))%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Ngày tạo" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <%# DateTime.Parse(Eval("CreationDate").ToString()).ToString("dd/MM/yyyy H:mm")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Lần đăng nhập cuối" HeaderStyle-HorizontalAlign="Left">
                            <ItemTemplate>
                                <%# DateTime.Parse(Eval("LastLoginDate").ToString()).ToString("dd/MM/yyyy H:mm")%>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="">
                            <ItemTemplate>
                                <a href='EditUser.aspx?u=<%# Eval("UserName") %>' class="btn btnGrid" title="Sửa Người Dùng" rel="btnEdit">Sửa</a>
                                <asp:LinkButton ID="lnkDelete" CssClass="btn btnGrid" runat="server" Text="Xóa" CommandArgument='<%# Eval("UserName") %>'
                                    CommandName="Delete" />
                                <asp:LinkButton ID="lnkStatus" CssClass="btn btnGrid" runat="server" Text="Khóa" CommandArgument='<%# Eval("UserName") %>'
                                    CommandName="Status" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="header" />
                    <PagerSettings Mode="NumericFirstLast" />
                    <PagerStyle CssClass="footer" />
                </asp:GridView>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
